/**
 * Created by Administrator on 2017/3/21.
 */
import React, {Component} from 'react';
import { Form, Input, Radio, Select, Switch, Button, Tooltip, Icon } from 'antd';
import request from '@/utils/request';
import { connect } from 'dva';
import styles from '../../layouts/password.less';
const FormItem = Form.Item;
const { TextArea } = Input;

const RadioGroup = Radio.Group;
const Option = Select.Option;
class AddPoliciesForm extends Component {
  constructor(props) {
    super(props);
    this.state = {
      all_roles:[],
      all_branches:[],
      level:0,
    };
  }
  componentDidMount() {
    const that=this;
  }
  render() {
    const formItemLayoutWithLabel = {
      labelCol: {
        xs: {span: 24},
        sm: {span: 7},
      },
      wrapperCol: {
        xs: {span: 24},
        sm: {span: 15},
      }
    };
    let branch_id=sessionStorage.getItem('branch_id');
    const {getFieldDecorator} = this.props.form;
    return (
      <div>
        <Form onSubmit={this.handleSubmit}>
          <FormItem
            {...formItemLayoutWithLabel}
            label={(
              <span>
                权限分组
            </span>
            )}
          >
            {getFieldDecorator('group', {
              initialValue: this.props.editRecord ? this.props.editRecord.group : '',
              rules: [{ required: true, message: '请输入名称' }],
            })(
              <Select>
              {
                [{name:'集中器管理'},{name:'账号角色'}].map((item,index)=>{
                  return <Option key={index} value={item.name}>{item.name}</Option>
                })
              }
              </Select>
            )}
          </FormItem>

          <FormItem
            {...formItemLayoutWithLabel}
            label={(
              <span>
                权限名称
            </span>
            )}
          >
            {getFieldDecorator('name', {
              initialValue: this.props.editRecord ? this.props.editRecord.name : '',
              rules: [{ required: true, message: '请输入名称' }],
            })(
              <Input />
            )}
          </FormItem>

        </Form>
      </div>
    );
  }
}

const AddPoliciesFormWrap = Form.create()(AddPoliciesForm);
export default connect()(AddPoliciesFormWrap);


